local que_wuling = fk.CreateSkill {
    name = "que_wuling",
    anim_type = "control",
    tags = { Skill.Compulsory }
}
Fk:loadTranslationTable {
    ["que_wuling"] = "巫灵",
    [":que_wuling"] = "锁定技，你受到其他角色造成的伤害、对其他角色造成的伤害均视为无来源；当其他角色受到无来源伤害后，其进行判定，若不为<font color='red'>♥</font>，其失去一点体力并弃置一张黑色牌，若没有弃牌，则失去两点体力。",

}

que_wuling:addEffect(fk.PreDamage, {
    anim_type = "offensive",
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(que_wuling.name) and
            ((target == player and data.to ~= player) or
                (data.from and data.from ~= player and data.to == player))
    end,
    on_use = function(self, event, target, player, data)
        data.from = nil
    end,
})

que_wuling:addEffect(fk.DamageInflicted, {
    anim_type = "offensive",
    can_trigger = function(self, event, target, player, data)
        return target ~= player and player:hasSkill(que_wuling.name) and not data.from
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local pattern = ".|.|^heart"
        local judge = {
            who = target,
            reason = "que_wuling",
            pattern = pattern,
        }
        room:judge(judge)
        if judge.card:matchPattern(pattern) then
            local card = room:askToDiscard(target, {
                min_num = 1,
                max_num = 1,
                include_equip = true,
                pattern = ".|.|club,spade",
                prompt = "巫灵：请弃置一张黑色牌，点击取消失去两点体力",
                skill_name = que_wuling.name,
                cancelable = true,
                skip = true,
            })
            if #card > 0 then
                room:throwCard(card, que_wuling.name, target, target)
                room:loseHp(target, 1, que_wuling.name)
            else
                room:loseHp(target, 2, que_wuling.name)
            end
        end
    end,
})
return que_wuling
